#include <stdlib.h>
#include <stdexcept>
#include <boost/asio.hpp>
#include "TCPServer.h"
#include "InputServerParams.h"
#include "database/Client.hpp"

int main(int argc, char **argv)
{
  InputServerParams input;
  input.parseInput(argc, argv);
  try
    {
      std::cout << "Launching server on port " << input.getPort() << std::endl;
      boost::asio::io_service ioService;
      TCPServer server(ioService, input.getPort());
      server.startAccept();
      ioService.run();
    }
  catch (std::exception& e)
    {
      std::cerr << e.what() << std::endl;
    }
  return (EXIT_SUCCESS);
}
